//
//  applyVC.m
//  EquiriesProject
//
//  Created by qianfeng on 15/10/31.
//  Copyright (c) 2015年 HXH. All rights reserved.
//

#import "applyVC.h"
#import "applyVCCell.h"

#define applyUrl @"http://wz.qichecdn.com/ashx/getapprecommend.ashx?&token=2&platform=2&version=3.2.0&qd=kqzs_cpa_test_w"

@interface applyVC ()<UITableViewDataSource,UITableViewDelegate>

@end

@implementation applyVC
{
    UITableView * _tableView;
    NSMutableArray * _titlearray;
    NSMutableArray * _descArray;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.view.backgroundColor = [UIColor colorWithRed:0.9 green:0.9 blue:0.9 alpha:1];
    
    [self createNav];
    [self getData];
    
    
    [self createTableView];
    
    
    
}

-(void)getData
{
    _titlearray = [NSMutableArray array];
    _descArray = [NSMutableArray array];
    NSArray * array = @[@"停车助手",@"汽车之家",@"车友会",@"二手车",@"汽车报价",@"德师傅车管家",@"养车之家"];
    NSArray * array1 = @[@"停车必备，方便你的停车",@"车主必备，让你精明用车",@"第一时间了解热门车型",@"值得信赖的二手车交易平台",@"买车神器，不花冤枉钱",@"保养、维修专家，在线观看服务视频",@"用车养车必备 省心又省钱"];
    [_titlearray setArray:array];
    [_descArray setArray:array1];
    
}

-(void)createTableView
{
    _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 64, WIDTH, HEIGHT-64) style:UITableViewStylePlain];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.showsVerticalScrollIndicator = NO;
    [self.view addSubview:_tableView];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _titlearray.count;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 80;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    applyVCCell * cell = [_tableView dequeueReusableCellWithIdentifier:@"cell"];
    if (!cell) {
        cell = [[[NSBundle mainBundle]loadNibNamed:@"applyVCCell" owner:nil options:nil]lastObject];
    }
    cell.titleLabel.text = _titlearray[indexPath.row];
    cell.descLabel.text = _descArray[indexPath.row];
    return cell;
}

-(void)createNav
{
    UILabel * label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, 120, 40)];
    label.text = @"精品应用";
    label.textAlignment = NSTextAlignmentCenter;
    label.textColor = [UIColor whiteColor];
    label.font = [UIFont systemFontOfSize:22];
    [self.view addSubview:label];
    self.navigationItem.titleView = label;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
